#include <iostream>

using namespace std;

void foo(int a)
{
        cout << __func__ << "(1)" << endl;

        if (a == 1) {
                throw 32167;
        } else if (a == 2) {
                throw 12345;
        } else if (a == 3) {
                throw 3.14;
        }

        cout << __func__ << "(2)" << endl;
}

extern "C" {
#include <stdlib.h>
}

int main(int argc, char **argv)
{
        if (argc != 2) {
                cout << "argment..." << endl;
                return 1;
        }

        int a;
        a = atoi(argv[1]);

        try {
                foo(a);
        }
        catch (int a) {
                cout << "catch exception int " << a << endl;
        }
        catch (double d) {
                cout << "catch exception double " << d << endl;
        }

        return 0;
}
